Skip to content

Conversation

nikdejan
Copy link

@nikdejan nikdejan commented Oct 1, 2025

Before this fix for columns like this:
agent_party_id: id foreing:agents.party_id
migration was generated like this:
$table->foreignId('agent_party_id')->constraints(); Which is a problem because this syntax assumes table name is 'agent_parties'.

Before this fix for columns like this:
agent_party_id: id foreing:agents.party_id
migration was generated like this:
$table->foreignId('agent_party_id')->constraints();
Which is a problem because this syntax assumes table name is 'agent_parties'.
@jasonmccreary
Copy link
Collaborator

Thanks for this. I would appreciate seeing a test fixture that drove out the solution or document/verifies the change.

@nikdejan
Copy link
Author

nikdejan commented Oct 2, 2025

Added strict, fixture-driven test for agent_party_id: id foreign:agents.party_id.
Before: generator used bare ->constrained() (only correct for {table}_id).
After: generator emits ->constrained('agents','party_id') and preserves existing cascade behavior.
Fixtures mirror the migration stub (docblocks + FK disable/enable).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants